package com.upload.weixin;

import com.github.sd4324530.fastweixin.api.OauthAPI;
import com.github.sd4324530.fastweixin.api.UserAPI;
import com.github.sd4324530.fastweixin.api.config.ApiConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by STARF on 2017/3/10.
 */
@Configuration
public class WeiXinConfiguration {

    @Value("${weixin.appID}")
    private final String appid = null;

    @Value("${weixin.appsecret}")
    private final String appsecret = null;

    @Bean
    ApiConfig apiConfig() {
        return new ApiConfig(appid,appsecret);
    }

    @Bean
    UserAPI userAPI() {
        return new UserAPI(apiConfig());
    }

    @Bean
    OauthAPI oauthAPI() {
        return new OauthAPI(apiConfig());
    }
}
